home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 12 / Mac Magazin and MacEasy Magazine CD - Issue 12.iso / CD Extras / Plug-ins / SODAColor / SODA-PlugIns-1 / Plug-In-Collection-1 / Transparent Link < prev    next >
Text File  |  1994-11-07  |  5KB  |  152 lines

  1. --SODABuildPlug
  2. --Transparent Link
  3.  
  4. ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
  5. SODAColor™
  6. Transparent Link :
  7.  
  8. This plug-in allows you to create transparent buttons in SODAColor which link to other cards.
  9.  
  10. LOADING THIS SCRIPT INTO SODACOLOR:
  11. 1.  Select "Load New Plug-In" from the plug-in list (TV-icon on edit palette).
  12. 2.  Select this document.
  13.  
  14. USING THIS PLUG-IN:
  15. 1.  Select a card you would like to link to from the list.
  16. 2.  Drag a rectangle over the area of the screen you want this button to cover
  17. 3.  Tell SODAColor whether or not you want this button hilited when clicked.
  18.  
  19. NOTE:  This button links you to another card by number not by name.  If you re-order your cards later on, this button may link to a different card. 
  20. ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
  21. on mouseUp
  22.   global CardNameList
  23.   createCardNameList
  24.   put "This plug-in allows you to create a link to another card by clicking over a transparent button on the screen." into myprompt
  25.   put "Do you want to create a link?" into prompt2
  26.   
  27.   answer myPrompt&return&return&prompt2 with "Cancel" or "Build it!"
  28.   if it is "Cancel" then exit mouseUp
  29.   
  30.   put the number of this card into Mike
  31.   put grabCards()into myCards
  32.   delete line 1 of myCards
  33.   put "Which card do you want to link to?" into myPrompt
  34.   put "LINK" into myButton
  35.   put getList(myPrompt,myCards,mybutton) into wally
  36.   if wally is empty then exit mouseUp
  37.   put wally+1 into wally
  38.   answer"Now please drag a rectangle over the area you want your button to cover"
  39.   put sodaRect() into myRect
  40.   lock screen
  41.   choose tool 2
  42.   put the number of cd btns into myBNum
  43.   domenu "New Button"
  44.   put myBNum+1 into myBNum
  45.   put "Linker"&&MyBnum into myBName
  46.   
  47.   if there is not a cd btn myBNum then
  48.     answer "Problem encountered.  Please make sure you're on the card layer"
  49.     exit mouseUp
  50.   end if
  51.   
  52.   set the name of cd btn myBNum to myBName
  53.   set the rect of cd btn myBName to myRect
  54.   set the showname of cd btn myBName to false
  55.   set the style of cd btn myBName to transparent
  56.   set the autohilite of cd btn myBname to true
  57.   
  58.   --Autohilite?
  59.   
  60.   answer "Do you want this button to invert when pressed?" with "No" or "Yes"
  61.   if it is "No" then set the autohilite of cd btn myBName to false
  62.   
  63.   --Link Script:
  64.   
  65.   put "Go cd"&&wally&return into myScript
  66.   put "Set the hilite of me to false" after myScript
  67.   put the script of bg btn "SODAPlugButt" into nuScript
  68.   put myScript into line 20 of nuScript
  69.   
  70.   --Flashing rect whilst repositioning:
  71.   
  72.   put " repeat until the mouseClick"&return into Repos
  73.   put "set the hilite of me to true"&return after Repos
  74.   put "set the hilite of me to false"&return after Repos
  75.   put Repos into line 5 of nuScript
  76.   
  77.   --Now Insert the Script:
  78.   
  79.   set the script of cd btn myBName to nuScript
  80.   
  81.   --Inform user:
  82.   
  83.   answer "•Option-Click on this button to re-position it."&return&¬
  84.   "•Command-Click to delete it"&return&"•Single-Click to run its script."
  85.   
  86.   choose tool 1
  87.   
  88. end mouseUp
  89.  
  90. function grabCards
  91.   repeat with curCard = 1 to number of cards
  92.     get the short name of card curCard
  93.     put curcard&".  "&it&return after myCards
  94.   end repeat
  95.   return myCards
  96. end grabCards
  97.  
  98. on doSort newPosition
  99.   global SortCount
  100.   lock screen
  101.   put zero into SortCount
  102.   put number of cards in this stack into numCards
  103.   put createSortList(numCards,newPosition) into sortList
  104.   go first card
  105.   -- use 'number of this card' because cards are not stored on disk sequentially
  106.   sort ascending numeric by item (number of this card) of sortList
  107.   go card newPosition
  108.   unlock screen
  109. end doSort
  110.  
  111. function createSortList numCards,newPosition
  112.   put empty into cardList
  113.   repeat with count = 1 to numCards
  114.     put count & "," after cardList
  115.   end repeat
  116.   delete last char of cardList
  117.   put number of this card into currentPosition
  118.   if newPosition <= currentPosition then
  119.     put 1 into adjust
  120.     put newPosition into start
  121.   else
  122.     put -1 into adjust
  123.     put currentPosition + 1 into start
  124.   end if
  125.   put start + abs(currentPosition - newPosition) - 1 into finish
  126.   put newPosition into item currentPosition of cardList
  127.   repeat with i = start to finish
  128.     add adjust to item i of cardList
  129.   end repeat
  130.   return cardList
  131. end createSortList
  132.  
  133. function GetList myPrompt,myList,myButton
  134.   put 1 into myLine
  135.   repeat forever
  136.     get showList(myList,myPrompt,false,true,¬
  137.     myButton&",Cancel",myLine)
  138.     put it into choice
  139.     put line 2 of choice into myLine
  140.     if line 1 of choice="Cancel" then
  141.       return empty
  142.       exit GetList
  143.     else if line 2 of choice is empty then
  144.       return empty
  145.       exit GetList
  146.     else
  147.       return myLine
  148.       exit GetList
  149.     end if
  150.   end repeat
  151. end GetList
  152.